<?php
namespace app\api\controller;

class Subject extends Authbase
{
    //增加formid
    public function addformid(){
        $formid = input("form_id");
        if(empty($formid)){
            $ret['code'] = 1;
            $ret['msg'] = "参数错误";
            return json($ret);
        }
        $now = time();
        $data['formid'] = $formid;
        $data['wx_user_id'] = $this->Auth_Wxuser_Id;
        $data['original_id'] = $this->Auth_Wxuser_OriginalId;
        $data['openid'] = $this->Auth_Wxuser_OpenId;
        $data['sendstate'] = 0;
        $data['addtime'] = $now;
        $data['uptime'] = $now;

        if(model("WechatUserFormidModel")->save($data)){
            $ret['code'] = 0;
            $ret['msg'] = 'success';
        }else{
            $ret['code'] = 1;
            $ret['msg'] = '保存失败';
        }
        return json($ret);
    }

}